package com.grad.why.studentsystem.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.grad.why.studentsystem.domain.Runtimecoursearrangeinfodetail;
import com.grad.why.studentsystem.mapper.RuntimecoursearrangeinfodetailMapper;
import com.grad.why.studentsystem.service.ClassesTableService;
import com.grad.why.studentsystem.service.RuntimeCourseArrangeInfoDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


import java.util.List;

@Component
@Service(interfaceClass = RuntimeCourseArrangeInfoDetailService.class)
public class RuntimeCourseArrangeInfoDetailServiceImpl implements RuntimeCourseArrangeInfoDetailService{
    @Autowired
    private RuntimecoursearrangeinfodetailMapper runtimecoursearrangeinfodetailMapper;

    @Override
    public List<Runtimecoursearrangeinfodetail> getRuntimeStudentArriveInfoList(int offset, int limit, String sort, String search) {
        try{
            return runtimecoursearrangeinfodetailMapper.getRuntimeStudentArrivedInfoList(offset,limit,sort,search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long getRuntimeStudentArriveInfoListLength(String search) {
        try{
            return runtimecoursearrangeinfodetailMapper.getRuntimeStudentArriveInfoListLength(search);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public Runtimecoursearrangeinfodetail getRuntimeCourseArrangeInfoDetailByCourseArrangeId(int coursearrangeid) {
        try{
            return runtimecoursearrangeinfodetailMapper.selectByPrimaryKey(coursearrangeid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public int checkCourseArrangeIdExist(Integer courseArrangeId) {
        try{
            return runtimecoursearrangeinfodetailMapper.checkCourseArrangeIdExist(courseArrangeId);
        }catch (Exception E) {
            E.printStackTrace();
        }
        return 0;
    }

    @Override
    public int updateByEntity(Runtimecoursearrangeinfodetail runtimecoursearrangeinfodetail) {
        try{
            return runtimecoursearrangeinfodetailMapper.updateByPrimaryKeySelective(runtimecoursearrangeinfodetail);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }

    @Override
    public List<Runtimecoursearrangeinfodetail> getAllDetails() {
        try{
            return runtimecoursearrangeinfodetailMapper.getAllDetails();
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public List<Runtimecoursearrangeinfodetail> getRuntimeStudentArriveInfoListByTeacherId(int offset, int limit, String search,int tid) {
        try{
            return runtimecoursearrangeinfodetailMapper.getRuntimeStudentArriveInfoListByTeacherId(offset,limit,search,tid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long getRuntimeStudentArriveInfoListLengthByTeacherId(String search, int bindid) {
        try{
            return runtimecoursearrangeinfodetailMapper.getRuntimeStudentArriveInfoListLengthByTeacherId(search,bindid);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
